package dw.object

/**
 * Basic class for all persistent objects.
 */
class PersistentObject {

	String	UUID,
			id
	
	Date	creationDate,
			lastModified
			
	def beforeInsert = {
		creationDate = new Date()
		lastModified = new Date()
	}
	
	def beforeUpdate = {
		lastModified = new Date()
	}
			
    static constraints = {		
		id(nullable: true)
		
		creationDate(nullable: true)
		lastModified(nullable: true)
    }
	
    static mapping = {
        id generator: "uuid", name: "UUID", column: "UUID", unique:"true"
		autoTimestamp false
    }
}
